package educationaladministrationsystem.CSM.Mapper.Root;

import educationaladministrationsystem.Class.Count;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface RootCountMapper {
    @Select("select * from count where identification between 1 and 2 limit #{page},#{pageNumber}")
    List<Count> getAllCount(int page, int pageNumber);

    @Select("select * from count where identification between 1 and 2 and( countNumber like concat('%',#{information},'%') or id like concat('%',#{information},'%') )limit #{page},#{pageNumber}")
    List<Count> getSearchCount(int page, int pageNumber, String information);

    @Select("select count(*) from count where identification between 1 and 2")
    int getPage();

    @Select("select * from count where countNumber=#{id}")
    Count getUpdateCountInformation(String id);

    @Update("update count set password=#{newPassword} where countNumber=#{countNumber}")
    void updateCount(String countNumber, String newPassword);
}
